body.home-v2-mounted {
  --home-v2-shell-gap: 24px;
  --home-v2-shell-width-compact: 300px;
  --home-v2-shell-width: clamp(390px, 34vw, 560px);
  --home-v2-shell-width-expanded: min(60vw, 920px);
  --home-v2-shell-space: var(--home-v2-shell-width-compact);
  --home-v2-panel-clearance: clamp(172px, 22vh, 240px);
  --home-v2-shell-top: clamp(6.6rem, 12vh, 8.6rem);
  --home-v2-shell-stack-gap: 1.15rem;
}

body.home-v2-mounted.home-v2-has-context {
  --home-v2-shell-space: var(--home-v2-shell-width);
}

body.home-v2-mounted.home-v2-has-context.home-v2-shell-expanded {
  --home-v2-shell-space: var(--home-v2-shell-width-expanded);
}

body.home-v2-mounted.home-v2-shell-collapsed {
  --home-v2-shell-space: 0px;
}

@media (min-width: 1180px) {
  body.home-v2-mounted .main-header,
  body.home-v2-mounted .main-scroll {
    padding-right: calc(5vw + var(--home-v2-shell-space) + var(--home-v2-shell-gap));
    transition: padding-right var(--motion-slow, 420ms) var(--ease-emph, cubic-bezier(.22,1,.36,1));
  }

  body.home-v2-mounted .input-bar {
    padding-right: 5vw;
  }

  body.home-v2-mounted .mobile-cards-toolbar,
  body.home-v2-mounted .mobile-cards-summary,
  body.home-v2-mounted .mobile-bottomnav {
    display: none !important;
  }
}

@media (max-width: 1179px) {
  .home-v2-layer {
    display: none !important;
  }

  body.home-v2-mounted .main-header,
  body.home-v2-mounted .main-scroll,
  body.home-v2-mounted .input-bar {
    padding-right: 5vw;
  }
}

.home-v2-layer {
  position: absolute;
  top: var(--home-v2-shell-top);
  right: 5vw;
  bottom: var(--home-v2-panel-clearance);
  width: var(--home-v2-shell-width-compact);
  display: flex;
  flex-direction: column;
  gap: var(--home-v2-shell-stack-gap);
  z-index: 18;
  pointer-events: none;
  transition:
    width var(--motion-slow, 420ms) var(--ease-emph, cubic-bezier(.22,1,.36,1)),
    opacity var(--motion-base, 240ms) ease,
    transform var(--motion-slow, 420ms) var(--ease-emph, cubic-bezier(.22,1,.36,1));
}

body.home-v2-mounted.home-v2-has-context .home-v2-layer {
  width: var(--home-v2-shell-width);
}

body.home-v2-mounted.home-v2-has-context.home-v2-shell-expanded .home-v2-layer {
  width: var(--home-v2-shell-width-expanded);
}

body.home-v2-mounted.home-v2-shell-collapsed .home-v2-layer {
  width: 280px;
}

.home-v2-shell-rail,
.home-v2-surface {
  pointer-events: auto;
}

.home-v2-shell-rail {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .52rem .8rem;
  border: 1px solid rgba(200, 169, 110, .24);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(200, 169, 110, .08), rgba(255, 255, 255, .03));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.home-v2-shell-rail.is-drag-target-ready {
  border-color: rgba(200, 169, 110, .34);
}

.home-v2-shell-rail.is-drop-target {
  border-color: rgba(200, 169, 110, .48);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .18), 0 0 0 1px rgba(200, 169, 110, .18);
  background: linear-gradient(90deg, rgba(200, 169, 110, .14), rgba(255, 255, 255, .05));
}

body.home-v2-mounted:not(.home-v2-has-context) .home-v2-shell-rail {
  padding-right: .56rem;
}

.home-v2-context-rail {
  display: flex;
  align-items: center;
  gap: .48rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.home-v2-context-rail.has-multi-tabs {
  gap: .34rem;
}

.home-v2-context-rail::-webkit-scrollbar {
  display: none;
}

.home-v2-context-tab {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  padding: .32rem .62rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: .76rem;
  font-weight: 500;
  cursor: pointer;
  opacity: .76;
  transition: all .38s cubic-bezier(0.175, 0.885, 0.32, 1.18);
  flex-shrink: 0;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
}

.home-v2-context-tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity .22s ease;
}

.home-v2-context-rail.has-multi-tabs .home-v2-context-tab:not(.is-active) {
  max-width: 42px;
  padding: .32rem .54rem;
}

.home-v2-context-rail.has-multi-tabs .home-v2-context-tab:not(.is-active) .home-v2-context-tab-label {
  opacity: 0;
  pointer-events: none;
}

.home-v2-context-rail.has-multi-tabs .home-v2-context-tab:not(.is-active) .home-v2-context-tab-close {
  display: none;
}

.home-v2-context-rail.has-multi-tabs .home-v2-context-tab:not(.is-active):hover {
  max-width: 240px;
  padding: .32rem .68rem;
  background: rgba(200, 169, 110, .07);
}

.home-v2-context-rail.has-multi-tabs .home-v2-context-tab:not(.is-active):hover .home-v2-context-tab-label {
  opacity: 1;
}

.home-v2-context-tab:hover {
  color: var(--text-main);
  background: var(--glass);
  opacity: 1;
}

.home-v2-context-tab.is-active {
  color: var(--text-main);
  border-color: rgba(200, 169, 110, .28);
  background: rgba(200, 169, 110, .10);
  opacity: 1;
}

.home-v2-context-group-marker {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 .5rem;
  border-radius: 999px;
  border: 1px solid rgba(200, 169, 110, .18);
  background: rgba(200, 169, 110, .05);
  color: var(--text-ghost);
  font-family: var(--sans);
  font-size: .54rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.home-v2-context-tab-icon {
  font-size: .9rem;
  opacity: .95;
}

.home-v2-context-tab-close {
  border: none;
  background: transparent;
  color: var(--text-ghost);
  width: 18px;
  height: 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .66rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.home-v2-context-tab-close:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--text-main);
}

.home-v2-rail-actions {
  display: flex;
  align-items: center;
  gap: .28rem;
  flex-shrink: 0;
}

.home-v2-rail-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: .92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
}

.home-v2-rail-btn:hover {
  color: var(--text-main);
  border-color: var(--border);
  background: var(--glass);
}

.home-v2-rail-btn.is-wide {
  width: auto;
  padding: 0 .72rem;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.home-v2-surface {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
    rgba(17, 24, 38, .86);
  box-shadow: 0 24px 54px rgba(0, 0, 0, .26);
  overflow: hidden;
  position: relative;
  transition:
    opacity var(--motion-base, 240ms) ease,
    transform var(--motion-slow, 420ms) var(--ease-emph, cubic-bezier(.22,1,.36,1));
}

[data-theme="light"] .home-v2-surface {
  background:
    linear-gradient(180deg, rgba(255,255,255,.68), rgba(255,255,255,.46)),
    rgba(248, 245, 239, .94);
  box-shadow: 0 20px 48px rgba(86, 63, 33, .10);
}

body.home-v2-mounted.home-v2-shell-collapsed .home-v2-surface {
  opacity: 0;
  transform: translateX(28px);
  pointer-events: none;
}

body.home-v2-mounted:not(.home-v2-has-context) .home-v2-surface {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.home-v2-pane-viewport {
  height: 100%;
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.home-v2-pane-viewport::-webkit-scrollbar {
  height: 6px;
}

.home-v2-pane-viewport::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.home-v2-pane {
  flex: 0 0 calc(100% - 2px);
  min-width: calc(100% - 2px);
  height: 100%;
  border-radius: 18px;
  background: rgba(8, 14, 24, .34);
  border: 1px solid rgba(255, 255, 255, .05);
  padding: 1.4rem 1.45rem 1.55rem;
  display: flex;
  flex-direction: column;
  scroll-snap-align: center;
  transition: opacity .24s ease, transform .24s ease;
  position: relative;
}

[data-theme="light"] .home-v2-pane {
  background: rgba(255, 255, 255, .54);
}

.home-v2-pane.is-dormant {
  opacity: .72;
}

.home-v2-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-v2-pane-heading {
  min-width: 0;
}

.home-v2-pane-kicker {
  font-family: var(--sans);
  font-size: .56rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-ghost);
  margin-bottom: .55rem;
}

.home-v2-pane-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.08;
  color: var(--text-main);
}

.home-v2-pane-subtitle {
  margin-top: .42rem;
  font-family: var(--sans);
  font-size: .74rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.home-v2-pane-tools {
  display: flex;
  align-items: center;
  gap: .36rem;
}

.home-v2-pane-tool {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-muted);
  font-size: .92rem;
  cursor: pointer;
  transition: all .2s ease;
}

.home-v2-pane-tool:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
  background: var(--glass-strong);
}

.home-v2-pane-summary {
  font-family: var(--garamond);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-main);
  padding: .95rem 1rem;
  border: 1px solid rgba(200, 169, 110, .16);
  background: rgba(200, 169, 110, .04);
  border-radius: 14px;
  margin-bottom: 1rem;
}

.home-v2-pane-body {
  min-height: 0;
  overflow-y: auto;
  padding-right: .2rem;
  display: flex;
  flex-direction: column;
  gap: .95rem;
}

.home-v2-pane-body.has-custom-content {
  padding-right: 0;
  gap: 0;
}

.home-v2-pane-custom-host {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.home-v2-pane-body.is-surface-body,
.home-v2-pane-custom-host.is-surface-host {
  height: 100%;
}

.home-v2-pane-custom-host > .inline-email-card {
  margin: 0;
}

.home-v2-section {
  border-top: 1px solid var(--rule);
  padding-top: .9rem;
}

.home-v2-section:first-child {
  border-top: none;
  padding-top: 0;
}

.home-v2-section-label {
  font-family: var(--sans);
  font-size: .56rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-ghost);
  margin-bottom: .55rem;
}

.home-v2-section-copy {
  font-family: var(--garamond);
  font-size: .94rem;
  line-height: 1.58;
  color: var(--text-main);
}

.home-v2-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .7rem;
}

.home-v2-mini-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  padding: .85rem .9rem;
  text-align: left;
}

button.home-v2-mini-card {
  width: 100%;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

button.home-v2-mini-card:hover {
  border-color: rgba(200, 169, 110, .28);
  background: rgba(200, 169, 110, .06);
  transform: translateY(-1px);
}

.home-v2-mini-label {
  font-family: var(--sans);
  font-size: .54rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--text-ghost);
  margin-bottom: .45rem;
}

.home-v2-mini-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.14;
  color: var(--text-main);
  margin-bottom: .34rem;
}

.home-v2-mini-meta {
  font-family: var(--sans);
  font-size: .68rem;
  line-height: 1.45;
  color: var(--text-ghost);
  margin-bottom: .34rem;
}

.home-v2-mini-copy {
  font-family: var(--sans);
  font-size: .72rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.home-v2-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: .52rem;
}

.home-v2-action-chip {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .04em;
  padding: .48rem .82rem;
  cursor: pointer;
  transition: all .2s ease;
}

.home-v2-action-chip:hover {
  border-color: rgba(200, 169, 110, .42);
  color: var(--accent);
  background: rgba(200, 169, 110, .07);
}

.home-v2-action-chip.is-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: rgba(10,15,23,.95);
  font-weight: 500;
}

.home-v2-action-chip.is-accent:hover {
  background: #d4c5a9;
  border-color: #d4c5a9;
  color: rgba(10,15,23,.95);
}

.home-v2-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  font-family: var(--garamond);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.home-v2-surface.is-empty .home-v2-empty {
  display: flex;
}

.home-v2-surface.is-empty .home-v2-pane-viewport {
  visibility: hidden;
}

.home-v2-pane[data-pane-type="mail"] .home-v2-pane-kicker {
  color: var(--c-email);
}

.home-v2-pane[data-pane-type="calendar"] .home-v2-pane-kicker {
  color: var(--c-calendar);
}

.home-v2-pane[data-pane-type="task"] .home-v2-pane-kicker {
  color: var(--c-status);
}

.home-v2-pane[data-pane-type="home"] .home-v2-pane-kicker {
  color: var(--accent);
}
