/* Spec 0126: /app right rail bug fixes.
 * Layer 2: Bug 2 CTA sizing. Layer 3+4: Bug 4 hero photo slot.
 *
 * Loaded on all 7 /app surfaces via a <link> tag in each HTML.
 * Additive only; no overrides to oem-dashboard.css or the inline
 * rail styles that already ship inside app.html.
 */

/* ── Rail flex pinning ────────────────────────────────────────── */
/*
 * oem-dashboard.css treats every rail child that is not .rail-photo
 * or .rail-focus-care as a shrinkable flex column with overflow
 * hidden. The 180 px hero card added below tips the rail past the
 * available height on modest viewports and the profile card was
 * getting collapsed to its header, hiding the bar and the HIN CTA.
 * Pin the profile card and its immediate scaffold so those stay
 * visible regardless of hero + notification density.
 */
.appshell-rail > .app-rail-profile {
  flex: 0 0 auto !important;
  overflow: visible !important;
  display: block !important;
}

/* ── Bug 2 fix: HIN CTA sizing ────────────────────────────────── */
/*
 * The rail CTA button carries an inline style="font:inherit" so it
 * picks up the enclosing rail typography. Left uncorrected the
 * parent context inflates the text well past the 12 to 13 px the
 * rail card should present. Force the size + weight explicitly and
 * beat the inline font shorthand by matching specificity (id).
 */
.app-rail-profile #appProfileCta.app-rail-profile-cta,
.app-rail-profile-cta {
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--brand-mariner-blue);
  text-decoration: none;
  display: inline-block;
  margin-top: 10px;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.app-rail-profile-cta:hover {
  text-decoration: underline;
}
.app-rail-profile-cta:focus-visible {
  outline: 2px solid var(--ymh-orange, var(--brand-sunset-orange));
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Bug 4 fix: right rail hero photo slot ────────────────────── */
/*
 * Full bleed placeholder card that sits ABOVE the existing identity
 * card in the right rail. Renders a gradient with a centered boat
 * silhouette by default; if data-photo-url is set on the element,
 * inline JS or a follow up spec swaps the background to the photo.
 *
 * Height matches the current identity card visual weight so the
 * combined stack does not feel top heavy.
 */
/*
 * Bump specificity with the parent selector so the generic
 * .appshell-rail > * min-height:0 + flex-shrink defaults do not
 * collapse the hero card. Sits in the same slot as .rail-photo does
 * further down; both are pinned via flex: 0 0 auto.
 */
/*
 * The generic .appshell-rail > * { min-height: 0 } rule in
 * oem-dashboard.css collapses grid+flex children when the rail runs
 * short vertically. Force the hero card to hold its footprint using
 * !important so subsurface pages with different rail densities
 * still render a visible photo slot.
 */
.appshell-rail > .app-rail-hero-photo,
.app-rail-hero-photo {
  position: relative;
  width: 100%;
  height: 180px !important;
  min-height: 180px !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(135deg, var(--brand-ocean-depths) 0%, var(--brand-mariner-blue) 100%);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 12px;
}
.app-rail-hero-photo[data-photo-url] {
  color: transparent;
}
.app-rail-hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 26, 47, 0) 55%,
    rgba(11, 26, 47, 0.35) 100%
  );
  pointer-events: none;
}
.app-rail-hero-photo-icon {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  opacity: 0.75;
}
.app-rail-hero-photo[data-photo-url] .app-rail-hero-photo-icon {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════
 * THE TOP BAR · spec 0599c (Figma 8rcqPM95zXXBMghQNuJLxk, Topbar 12:634)
 * ═══════════════════════════════════════════════════════════════════
 * One bar, drawn by the shell on every /app page and on /try, styled
 * here and nowhere else: oem-dashboard.css, app-shell-mobile.css and the
 * pages' own <style> blocks carry no bar rule any more, and no script
 * paints one. Tokens only, no !important.
 *
 * Three forms, chosen deterministically (spec 9.4):
 *   phone      below 768: menu, boat name, badge label, bell (12:620)
 *   drawer     768 to 1023: menu, boat name, help circle, badge label,
 *              Upgrade (free only), bell, no title (Tablet 213:474)
 *   sidebar    1024 and up: title, dot, crumb, then the help pill and the
 *              full badge when the bar itself is wide enough (Desktop
 *              12:584), else the help circle and the badge label
 *              (Compact 213:452). The switch is a container query on the
 *              bar's own width; the threshold was measured with a 40
 *              character boat name (see the @container rule below).
 * The boat crumb is the only element that may ellipsize.
 */
.appshell-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  container: ymh-topbar / inline-size;
  box-sizing: border-box;
  min-width: 0;
  height: 64px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  background: var(--neutral-surface);
  border-bottom: 1px solid var(--neutral-line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.appshell-topbar,
.appshell-topbar * { white-space: nowrap; }

.appshell-tb-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}
.appshell-tb-title {
  flex: none;
  font-size: 13.5px;
  line-height: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.appshell-tb-sep {
  flex: none;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-muted);
}
.appshell-tb-crumb {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--text-link);
}
.appshell-tb-sep[hidden],
.appshell-tb-crumb[hidden] { display: none; }

.appshell-tb-right {
  flex: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}
.appshell-tb-right > .appshell-tb-chip   { order: 1; }
.appshell-tb-right > .appshell-tb-badge  { order: 2; }
.appshell-tb-right > .appshell-tb-cta    { order: 3; }
.appshell-tb-right > .appshell-notif-wrap { order: 4; }
.appshell-tb-right > .appshell-tb-demo   { order: 5; }

/* "What can I ask?" and Upgrade share the App Outline pill. */
.appshell-tb-chip,
.appshell-tb-cta {
  flex: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 10px 18px;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-pill);
  background: var(--neutral-surface);
  color: var(--text-link);
  font-family: inherit;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.appshell-tb-chip svg,
.appshell-tb-cta svg { flex: none; width: 14px; height: 14px; }
.appshell-tb-chip:hover,
.appshell-tb-cta:hover { background: var(--neutral-subtle); }
.appshell-tb-chip:focus-visible,
.appshell-tb-cta:focus-visible,
.appshell-burger:focus-visible,
.appshell-topbar .appshell-notif-btn:focus-visible {
  outline: 2px solid var(--brand-sunset-orange);
  outline-offset: 2px;
}
.appshell-tb-cta[hidden] { display: none; }

/* The plan badge (Figma 7:23): the tier, then the VesselIQ model. */
.appshell-tb-badge {
  flex: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-pill);
  background: var(--neutral-subtle);
}
.appshell-tb-badge-label {
  font-size: 10px;
  line-height: 14px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-link);
}
.appshell-tb-badge-model {
  font-size: 11.5px;
  line-height: 16px;
  font-weight: 400;
  color: var(--text-strong);
}

/* The bell (ymh-notifications.js mounts it): a 36 px circle with an
   18 px stroke icon and a 44 px tap target. */
.appshell-topbar .appshell-notif-wrap { flex: none; }
.appshell-topbar .appshell-notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--neutral-subtle);
  color: var(--text-primary);
}
.appshell-topbar .appshell-notif-btn:hover { background: var(--neutral-line); }
.appshell-topbar .appshell-notif-btn svg { width: 18px; height: 18px; }
.appshell-topbar .appshell-notif-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
}

/* Demo mode only ("Guest" and Reset, ?demo=1). */
.appshell-tb-demo {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.appshell-tb-demo[hidden] { display: none; }
.appshell-identity-reset {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text-link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* The menu button, the way into the drawer below 1024. */
.appshell-burger {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -1px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}
.appshell-burger:hover { background: var(--neutral-subtle); }
.appshell-burger svg { display: block; width: 22px; height: 22px; }

/* ── Sidebar mode (1024 and up): Compact by default, Desktop when the bar
 * fits it. The threshold is the full form's measured width with a 40
 * character boat name, the crumb held at the compact frame's 260 px:
 * 961 px of bar, padding included (measured 2026-10-21 on the free
 * account with Upgrade, the widest right cluster; Superyacht without
 * Upgrade needs 879). The threshold is 980 px of bar with a little slack.
 * A container query reads the content box, so it is written as 932 px
 * (980 less the 24 px padding on each side). */
@media (min-width: 1024px) {
  .appshell-topbar { grid-column: 2 / -1; }
  .appshell-burger { display: none; }
  .appshell-tb-crumb { max-width: 260px; }
  .appshell-tb-chip {
    width: 40px;
    padding: 0;
  }
  .appshell-tb-chip svg { width: 16px; height: 16px; }
  .appshell-tb-chip-label,
  .appshell-topbar .appshell-tb-badge-model { display: none; }
  @container ymh-topbar (min-width: 932px) {
    .appshell-tb-crumb { max-width: none; }
    .appshell-tb-chip { width: auto; padding: 10px 18px; }
    .appshell-tb-chip svg { width: 14px; height: 14px; }
    .appshell-tb-chip-label { display: inline; }
    .appshell-topbar .appshell-tb-badge-model { display: inline; }
  }
}

/* ── Drawer mode (768 to 1023, Figma 213:474) and phones: the bar is
 * fixed to the window, the title gives way to the boat name. */
@media (max-width: 1023.98px) {
  .appshell-topbar {
    position: fixed;
    top: calc(var(--vvtop, 0px) + var(--ymh-viewas-h, 0px));
    left: 0;
    right: 0;
    z-index: 50;
    padding: 0 24px 0 16px;
  }
  .appshell-tb-title,
  .appshell-tb-sep,
  .appshell-tb-sep[hidden] { display: none; }
  .appshell-tb-crumb {
    flex: 1 1 auto;
    font-size: 16px;
    line-height: 22px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .appshell-tb-chip {
    width: 40px;
    padding: 0;
  }
  .appshell-tb-chip svg { width: 16px; height: 16px; }
  .appshell-tb-chip-label,
  .appshell-topbar .appshell-tb-badge-model { display: none; }
}

/* ── Phone (Figma 12:620): 56 tall; "What can I ask?" and Upgrade live
 * outside the bar (the home's Skills chips, the Limit notice and
 * Settings › Billing). */
@media (max-width: 767.98px) {
  .appshell-topbar {
    height: 56px;
    gap: 8px;
    padding: 0 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .appshell-tb-left { gap: 8px; }
  .appshell-tb-right { gap: 8px; }
  .appshell-tb-chip,
  .appshell-tb-cta { display: none; }
  .appshell-tb-cta[hidden] { display: none; }
}

/* A printed page (the pre-trip sheet) carries no chrome. */
@media print {
  .appshell-topbar { display: none; }
}

/* ── App buttons and the Free billing card · spec 0599c 9.14 ──────────
 * Figma Button 5:114 (App size, Primary and Outline) and the Billing
 * frames 215:269 / 215:644. Only the free card and the portal button use
 * them; the rest of Settings waits for its own page pass (S3b). */
.ymh-app-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.ymh-app-btn-primary {
  border: 0;
  background: var(--brand-sunset-orange);
  color: var(--text-strong);
}
.ymh-app-btn-outline {
  border: 1px solid var(--neutral-line);
  background: var(--neutral-surface);
  color: var(--text-link);
}
.ymh-app-btn-outline:hover { background: var(--neutral-subtle); }
.ymh-app-btn:focus-visible {
  outline: 2px solid var(--brand-sunset-orange);
  outline-offset: 2px;
}
.ymh-app-btn:disabled { cursor: default; opacity: 0.6; }
.ymh-billing-free {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 24px 0 0;
  padding: 16px 20px;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-md);
  background: var(--neutral-surface);
}
.ymh-billing-free[hidden] { display: none; }
/* Documents with nothing on file (combined audit B P2-3): the same quiet
   card as Billing's Free card, one line and the Primary Upload. */
.ymh-docs-empty {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  max-width: 560px;
  margin: 24px auto 0;
  padding: 16px 20px;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-md);
  background: var(--neutral-surface);
}
.ymh-docs-empty[hidden] { display: none; }
.ymh-docs-empty-p { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-secondary); }
.ymh-billing-free-h {
  margin: 0;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  color: var(--text-primary);
}
.ymh-billing-free-p {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
}

/* Spec 0599f 3.3 · the neutral Upsell Notice (Figma 14:464) on /app/notes
   and /app/inventory for a Free boat: a stroke lock, the server's line,
   See plans and Back to chat. Neutral: no warning colour, nothing failed. */
.ymh-upsell-notice { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--neutral-divider-strong); border-radius: var(--radius-md); background: var(--neutral-surface); color: var(--text-primary); }
.ymh-upsell-notice[hidden] { display: none; }
/* Spec 0599f 3.6 (G8) · the Free Projects drop line, in a board column:
   the notice's surface and 14/20 type, sized to its text (no fixed
   height), and the column's empty placeholder gives way while it shows. */
.ymh-upsell-notice--drop { display: block; margin: 0; padding: 12px 14px; font-size: 14px; line-height: 20px; font-weight: 400; text-align: left; white-space: normal; height: auto; }
.app-kanban-col-body:has([data-role="photo-drop-free"]) .app-kanban-empty { display: none; }
/* Spec 0599f (cold audit) · a notice above an app's navy panel, and the
   crew banner (crew-chrome.js) at the top of the content column, sit on
   the panel's own gutter (focus-apps.css .app-navy: 32 px, 12 px at 640
   and under), not from the sidebar edge to the window edge. */
#ymhCrewPlanBanner { margin: 0 0 12px; }
.appshell-app > .ymh-upsell-notice,
.appshell-app > #ymhCrewPlanBanner { margin: 0 32px 16px; }
@media (max-width: 640px) {
  .appshell-app > .ymh-upsell-notice,
  .appshell-app > #ymhCrewPlanBanner { margin: 0 12px 12px; }
}
.ymh-upsell-notice-icon { flex: none; display: flex; padding-top: 1px; color: var(--text-primary); }
.ymh-upsell-notice-icon svg { display: block; }
.ymh-upsell-notice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ymh-upsell-notice-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-primary); }
.ymh-upsell-notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ymh-upsell-notice-cta,
.ymh-upsell-notice-back { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--radius-control); font-size: 14px; font-weight: 600; text-decoration: none; }
.ymh-upsell-notice-cta { background: var(--brand-mariner-blue); color: var(--neutral-white); border: 1px solid var(--brand-mariner-blue); }
.ymh-upsell-notice-back { background: transparent; color: var(--text-link); border: 1px solid var(--neutral-divider-strong); }
.ymh-upsell-notice-cta:focus-visible,
.ymh-upsell-notice-back:focus-visible { outline: 2px solid var(--brand-sunset-orange); outline-offset: 2px; }

/* Settings › Crew (G3): the headline above the Upsell Notice's sentence. */
.ymh-upsell-notice-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-primary); }

/* Spec 0599d 3.6 · Free and Owner walk in the chat: the link to the
   inspection page goes when whoami says inspectionsNav is false
   (appshell.js), before paint once a tab has seen it. */
html.ymh-no-insp-nav .appshell-nav-item[href="/app/pretrip"],
html.ymh-no-insp-nav a.app-rail-profile-cta[href="/app/pretrip"],
.appshell-nav-item[href="/app/pretrip"][hidden],
a.app-rail-profile-cta[href="/app/pretrip"][hidden] { display: none; }
