/* Module-specific styles — shared tokens come from /shared.css */
html, body { height: 100%; overflow: hidden; }

/* ── Shell layout ── */
.shell {
  display: flex;
  height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(29, 120, 116, 0.08), transparent 28%),
    linear-gradient(180deg, #f8f6f1 0%, #f5f2eb 100%);
}

/* ── Sidebar ── */
.shell-sidebar {
  width: 72px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(247, 246, 243, 0.98) 100%);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 10px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 100;
  transition: width 0.22s ease, padding 0.22s ease, box-shadow 0.22s ease;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.45), 12px 0 40px rgba(28, 27, 25, 0.04);
}
.shell-sidebar.expanded {
  width: 236px;
  padding: 14px 12px;
}
.shell-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(28, 27, 25, 0.06);
}
.shell-sidebar.collapsed .shell-sidebar-header {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}
.shell-sidebar.expanded .shell-sidebar-header {
  flex-direction: row;
}
.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.shell-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(29, 120, 116, 0.14);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(29, 120, 116, 0.08);
}
.shell-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  display: block;
}
.shell-brand-copy {
  min-width: 0;
}
.shell-brand-title {
  font-family: var(--font-heading);
  font-size: var(--text-ui);
  font-weight: 700;
  color: var(--color-text);
  line-height: var(--leading-tight);
}
.shell-brand-subtitle {
  margin-top: 2px;
  font-size: var(--text-overline);
  color: var(--color-text-tertiary);
}
.shell-sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
.shell-sidebar.collapsed .shell-sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.shell-sidebar-toggle:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
  border-color: var(--color-border-strong, var(--color-border));
}
.shell-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding-top: 4px;
}
.shell-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shell-nav-group-label {
  padding: 6px 10px 4px;
  font-size: var(--text-overline);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}
.shell-nav-item {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
  position: relative;
  padding: 0 10px;
  text-align: left;
}
.shell-sidebar.expanded .shell-nav-item {
  justify-content: flex-start;
}
.shell-nav-item:hover { background: var(--color-bg-tertiary); color: var(--color-text); }
.shell-nav-item.active {
  background: var(--color-brand-light); color: var(--color-brand);
  box-shadow: inset 0 0 0 1px rgba(29,120,116,0.08), 0 4px 14px rgba(29,120,116,0.06);
}
.shell-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.shell-nav-label {
  font-size: var(--text-ui);
  font-weight: 600;
  line-height: var(--leading-snug);
  white-space: nowrap;
}
.shell-nav-item .tooltip {
  display: none; position: absolute; left: 54px; top: 50%; transform: translateY(-50%);
  background: var(--color-text); color: #fff; padding: 4px 10px; border-radius: 6px;
  font-size: var(--text-meta); font-family: var(--font-body); white-space: nowrap; z-index: 200;
  pointer-events: none;
}
.shell-sidebar.collapsed .shell-nav-item:hover .tooltip { display: block; }
.shell-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}
.shell-bottom-action,
.shell-user {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  padding: 0 10px;
  transition: all 0.15s ease;
  text-align: left;
}
.shell-sidebar.expanded .shell-bottom-action,
.shell-sidebar.expanded .shell-user {
  justify-content: flex-start;
}
.shell-bottom-action:hover,
.shell-user:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}
.shell-bottom-action-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.shell-bottom-action-label {
  font-size: var(--text-ui);
  font-weight: 600;
}
.shell-connection {
  width: 100%;
  min-height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-text-tertiary);
  font-size: var(--text-meta);
  padding: 0 10px;
}
.shell-sidebar.expanded .shell-connection {
  justify-content: flex-start;
}
.shell-connection.offline {
  color: var(--color-text-tertiary);
}
.shell-sync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2D8A39;
  flex-shrink: 0;
}
.shell-sync-dot.offline { background: var(--color-text-tertiary); }
.shell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
}
.shell-avatar-fallback {
  background: var(--color-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--text-meta);
  font-weight: 600;
  font-family: var(--font-heading);
}
.shell-user-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.shell-user-name {
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-user-action {
  font-size: var(--text-overline);
  color: var(--color-text-tertiary);
}

/* ── Content area ── */
.shell-content {
  flex: 1;
  min-width: 0;
  padding: 18px 18px 18px 14px;
  overflow: hidden;
}
.shell-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.shell-stage-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 8px 0;
}
.shell-stage-copy {
  min-width: 0;
}
.shell-stage-kicker {
  font-size: var(--text-overline);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
}
.shell-stage-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.shell-stage-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-title-lg);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
}
.shell-stage-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: var(--text-overline);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.shell-stage-status.ready {
  background: rgba(29, 120, 116, 0.1);
  color: var(--color-brand);
}
.shell-stage-status.loading {
  background: rgba(148, 143, 132, 0.12);
  color: var(--color-text-secondary);
}
.shell-stage-description {
  margin: 8px 0 0;
  max-width: 680px;
  color: var(--color-text-secondary);
  font-size: var(--text-ui);
  line-height: var(--leading-normal);
}
.shell-stage-user {
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(29, 120, 116, 0.1);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 30px rgba(19, 32, 41, 0.05);
  text-align: right;
}
.shell-stage-user-label {
  display: block;
  margin-bottom: 4px;
  font-size: var(--text-overline);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}
.shell-stage-user strong {
  font-size: var(--text-ui);
  color: var(--color-text);
}
.shell-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(29, 120, 116, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(250, 248, 244, 0.88) 100%);
  box-shadow:
    0 30px 60px rgba(19, 32, 41, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.shell-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
}
.shell-content iframe.hidden { display: none; }

/* ── Auth screen ── */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-secondary); font-family: var(--font-body);
}
.auth-card {
  background: var(--color-bg); padding: 48px 40px; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08); text-align: center; max-width: 380px; width: 90%;
}
.auth-title {
  font-family: var(--font-heading); font-size: 24px; font-weight: 700;
  color: var(--color-text); margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 14px; color: var(--color-text-tertiary); margin-bottom: 24px;
}
.auth-error {
  color: #C93B28; font-size: 13px; margin-top: 12px; padding: 8px 12px;
  background: #FEF0EF; border-radius: 6px;
}
#google-signin-btn { display: inline-block; margin: 0 auto; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .shell {
    background: linear-gradient(180deg, #f8f6f1 0%, #f5f2eb 100%);
  }
  .shell-sidebar,
  .shell-sidebar.expanded {
    width: 56px;
    padding: 10px 6px;
  }
  .shell-brand-copy,
  .shell-nav-group-label,
  .shell-nav-label,
  .shell-bottom-action-label,
  .shell-user-copy,
  .shell-connection span {
    display: none;
  }
  .shell-nav-item,
  .shell-bottom-action,
  .shell-user {
    justify-content: center;
    padding: 0;
  }
  .shell-logo { width: 30px; height: 30px; font-size: 12px; }
  .shell-sidebar-toggle { display: none; }
  .shell-content {
    padding: 10px 10px 10px 8px;
  }
  .shell-stage {
    gap: 10px;
  }
  .shell-stage-header {
    padding: 0 2px;
  }
  .shell-stage-title {
    font-size: 22px;
  }
  .shell-stage-description,
  .shell-stage-user {
    display: none;
  }
  .shell-viewport {
    border-radius: 20px;
  }
}
